//////////////////////////////////////////////////////////////////////////
// FileName:
// CreateBy:
// CreateDate:2010/5/25
// Description:
//		BusAccident class
//
// Modify Log:
//
// Copyright:
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Auto.Components;

namespace Auto.Data.BusMan.Model
{
    [Serializable]
    public class BusAccident
    {
        #region --Field--
        ///<summary>
        ///Data Table Bus_BusAccident
        ///</summary>
        public const string TABLENAME_Bus_BusAccident = "Bus_BusAccident";
        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_RecID = "RecID";
        /// <sumary> 
        /// (DocID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DocID = "DocID";
        /// <sumary> 
        /// (BusID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_BusID = "BusID";

        /// <summary>
        /// (BusIdentificationNO Type:NVarChar:50) FROM BusList
        /// </summary>
        public const string FIELD_BusIdentificationNO = "BusIdentificationNO";

        /// <sumary> 
        /// (CompanyID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_CompanyID = "CompanyID";
        /// <sumary> 
        /// (CompanyName Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_CompanyName = "CompanyName";
        /// <sumary> 
        /// (DriverID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DriverID = "DriverID";
        /// <sumary> 
        /// (AccidentTime Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_AccidentTime = "AccidentTime";
        /// <sumary> 
        /// (AccidentAddress Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_AccidentAddress = "AccidentAddress";
        /// <sumary> 
        /// (AccidentDesc Type:NVarChar Len:4000) 
        /// </sumary> 
        public const string FIELD_AccidentDesc = "AccidentDesc";
        /// <sumary> 
        /// (AccidentPic Type:NVarChar Len:200) 
        /// </sumary> 
        public const string FIELD_AccidentPic = "AccidentPic";
        /// <sumary> 
        /// (AccidentOtherPic Type:NVarChar Len:200) 
        /// </sumary> 
        public const string FIELD_AccidentOtherPic = "AccidentOtherPic";
        /// <sumary> 
        /// (AccidentResponsibility Type:NVarChar Len:4000) 
        /// </sumary> 
        public const string FIELD_AccidentResponsibility = "AccidentResponsibility";
        /// <sumary> 
        /// (TrafficPoliceDisposition Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_TrafficPoliceDisposition = "TrafficPoliceDisposition";
        /// <sumary> 
        /// (TrafficProcessRecord Type:NText Len:4000) 
        /// </sumary> 
        public const string FIELD_TrafficProcessRecord = "TrafficProcessRecord";
        /// <sumary> 
        /// (TotalCost Type:Decimal Len:0) 
        /// </sumary> 
        public const string FIELD_TotalCost = "TotalCost";
        /// <sumary> 
        /// (InsurancePay Type:Decimal Len:0) 
        /// </sumary> 
        public const string FIELD_InsurancePay = "InsurancePay";
        /// <sumary> 
        /// (AdversePartyPay Type:Decimal Len:0) 
        /// </sumary> 
        public const string FIELD_AdversePartyPay = "AdversePartyPay";
        /// <sumary> 
        /// (DriverPay Type:Decimal Len:0) 
        /// </sumary> 
        public const string FIELD_DriverPay = "DriverPay";
        /// <sumary> 
        /// (CompanyPay Type:Decimal Len:0) 
        /// </sumary> 
        public const string FIELD_CompanyPay = "CompanyPay";
        /// <sumary> 
        /// (CompleteDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_CompleteDate = "CompleteDate";
        /// <sumary> 
        /// (RecDivID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_RecDivID = "RecDivID";
        /// <sumary> 
        /// (RecAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_RecAcct = "RecAcct";
        /// <sumary> 
        /// (RecDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_RecDate = "RecDate";
        /// <sumary> 
        /// (Note Type:NVarChar Len:200) 
        /// </sumary> 
        public const string FIELD_Note = "Note";
        /// <sumary> 
        /// (UserAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_UserAcct = "UserAcct";
        /// <sumary> 
        /// (LastUpdateDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_LastUpdateDate = "LastUpdateDate";
        #endregion --Field--

        #region --Property--
        private int _recid;
        private string _docid;
        private string _busid;
        private string _busidentificationno;
        private string _companyid;
        private string _companyname;
        private string _driverid;
        private DateTime _accidenttime;
        private string _accidentaddress;
        private string _accidentdesc;
        private string _accidentpic;
        private string _accidentotherpic;
        private string _accidentresponsibility;
        private string _trafficpolicedisposition;
        private string _trafficprocessrecord;
        private decimal _totalcost;
        private decimal _insurancepay;
        private decimal _adversepartypay;
        private decimal _driverpay;
        private decimal _companypay;
        private DateTime _completedate;
        private string _recdivid;
        private string _recacct;
        private DateTime _recdate;
        private string _note;
        private string _useracct;
        private DateTime _lastupdatedate;

        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public int RecID
        {
            set { _recid = value; }
            get { return _recid; }
        }

        /// <sumary> 
        /// (DocID Type:VarChar Len:20) 
        /// </sumary> 
        public string DocID
        {
            set { _docid = value; }
            get { return _docid; }
        }

        /// <sumary> 
        /// (BusID Type:VarChar Len:20) 
        /// </sumary> 
        public string BusID
        {
            set { _busid = value; }
            get { return _busid; }
        }

        /// <summary>
        /// (BusIdentificationNO Type:NVarChar Len:50)  FROM BusList
        /// </summary>
        public string BusIdentificationNO
        {
            set { _busidentificationno = value; }
            get { return _busidentificationno; }
        }

        /// <sumary> 
        /// (CompanyID Type:VarChar Len:20) 
        /// </sumary> 
        public string CompanyID
        {
            set { _companyid = value; }
            get { return _companyid; }
        }

        /// <sumary> 
        /// (CompanyName Type:NVarChar Len:50) 
        /// </sumary> 
        public string CompanyName
        {
            set { _companyname = value; }
            get { return _companyname; }
        }

        /// <sumary> 
        /// (DriverID Type:VarChar Len:20) 
        /// </sumary> 
        public string DriverID
        {
            set { _driverid = value; }
            get { return _driverid; }
        }

        /// <sumary> 
        /// (AccidentTime Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime AccidentTime
        {
            set { _accidenttime = value; }
            get { return _accidenttime; }
        }

        /// <sumary> 
        /// (AccidentAddress Type:NVarChar Len:50) 
        /// </sumary> 
        public string AccidentAddress
        {
            set { _accidentaddress = value; }
            get { return _accidentaddress; }
        }

        /// <sumary> 
        /// (AccidentDesc Type:NVarChar Len:200) 
        /// </sumary> 
        public string AccidentDesc
        {
            set { _accidentdesc = value; }
            get { return _accidentdesc; }
        }

        /// <sumary> 
        /// (AccidentPic Type:NVarChar Len:200) 
        /// </sumary> 
        public string AccidentPic
        {
            set { _accidentpic = value; }
            get { return _accidentpic; }
        }

        /// <sumary> 
        /// (AccidentOtherPic Type:NVarChar Len:200) 
        /// </sumary> 
        public string AccidentOtherPic
        {
            set { _accidentotherpic = value; }
            get { return _accidentotherpic; }
        }
        /// <sumary> 
        /// (AccidentResponsibility Type:NVarChar Len:200) 
        /// </sumary> 
        public string AccidentResponsibility
        {
            set { _accidentresponsibility = value; }
            get { return _accidentresponsibility; }
        }

        /// <sumary> 
        /// (TrafficPoliceDisposition Type:NVarChar Len:100) 
        /// </sumary> 
        public string TrafficPoliceDisposition
        {
            set { _trafficpolicedisposition = value; }
            get { return _trafficpolicedisposition; }
        }

        /// <sumary> 
        /// (TrafficProcessRecord Type:NText Len:1073741823) 
        /// </sumary> 
        public string TrafficProcessRecord
        {
            set { _trafficprocessrecord = value; }
            get { return _trafficprocessrecord; }
        }

        /// <sumary> 
        /// (TotalCost Type:Decimal Len:0) 
        /// </sumary> 
        public decimal TotalCost
        {
            set { _totalcost = value; }
            get { return _totalcost; }
        }

        /// <sumary> 
        /// (InsurancePay Type:Decimal Len:0) 
        /// </sumary> 
        public decimal InsurancePay
        {
            set { _insurancepay = value; }
            get { return _insurancepay; }
        }

        /// <sumary> 
        /// (AdversePartyPay Type:Decimal Len:0) 
        /// </sumary> 
        public decimal AdversePartyPay
        {
            set { _adversepartypay = value; }
            get { return _adversepartypay; }
        }

        /// <sumary> 
        /// (DriverPay Type:Decimal Len:0) 
        /// </sumary> 
        public decimal DriverPay
        {
            set { _driverpay = value; }
            get { return _driverpay; }
        }

        /// <sumary> 
        /// (CompanyPay Type:Decimal Len:0) 
        /// </sumary> 
        public decimal CompanyPay
        {
            set { _companypay = value; }
            get { return _companypay; }
        }

        /// <sumary> 
        /// (CompleteDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime CompleteDate
        {
            set { _completedate = value; }
            get { return _completedate; }
        }

        /// <sumary> 
        /// (RecDivID Type:VarChar Len:20) 
        /// </sumary> 
        public string RecDivID
        {
            set { _recdivid = value; }
            get { return _recdivid; }
        }

        /// <sumary> 
        /// (RecAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string RecAcct
        {
            set { _recacct = value; }
            get { return _recacct; }
        }

        /// <sumary> 
        /// (RecDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime RecDate
        {
            set { _recdate = value; }
            get { return _recdate; }
        }

        /// <sumary> 
        /// (Note Type:NVarChar Len:200) 
        /// </sumary> 
        public string Note
        {
            set { _note = value; }
            get { return _note; }
        }

        /// <sumary> 
        /// (UserAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string UserAcct
        {
            set { _useracct = value; }
            get { return _useracct; }
        }

        /// <sumary> 
        /// (LastUpdateDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime LastUpdateDate
        {
            set { _lastupdatedate = value; }
            get { return _lastupdatedate; }
        }

        #endregion --Property--

        #region --New--
        /// <summary>
        /// Constructed Function
        /// </summary>
        public BusAccident()
        {
            Init();
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dr">DataRow</param>
        public BusAccident(DataRow dr)
        {
            Init();
            SetModel(dr);
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dt">DataTable</param>
        public BusAccident(DataTable dt)
        {
            Init();
            SetModel(dt);
        }
        #endregion --New--

        #region --Private--
        /// <summary>
        /// Init The Private variable
        /// </summary>
        private void Init()
        {
            _recid = 0;
            _docid = string.Empty;
            _busid = string.Empty;
            _busidentificationno = string.Empty;
            _companyid = string.Empty;
            _companyname = string.Empty;
            _driverid = string.Empty;
            _accidenttime = DateTime.MinValue;
            _accidentaddress = string.Empty;
            _accidentdesc = string.Empty;
            _accidentpic = string.Empty;
            _accidentotherpic = string.Empty;
            _accidentresponsibility = string.Empty;
            _trafficpolicedisposition = string.Empty;
            _trafficprocessrecord = string.Empty;
            _totalcost = 0;
            _insurancepay = 0;
            _adversepartypay = 0;
            _driverpay = 0;
            _companypay = 0;
            _completedate = DateTime.MinValue;
            _recdivid = string.Empty;
            _recacct = string.Empty;
            _recdate = DateTime.MinValue;
            _note = string.Empty;
            _useracct = string.Empty;
            _lastupdatedate = DateTime.MinValue;
        }
        /// <summary>
        /// SetModel By DataRow
        /// </summary>
        /// <param name="dr">DataRow</param>
        /// <returns>BusAccident</returns>
        private BusAccident SetModel(DataRow dr)
        {
            _recid = StrHelper.GetIntValue(dr[FIELD_RecID]);
            _docid = StrHelper.GetStringValue(dr[FIELD_DocID]);
            _busid = StrHelper.GetStringValue(dr[FIELD_BusID]);
            _busidentificationno = StrHelper.GetStringValue(dr[FIELD_BusIdentificationNO]);
            _companyid = StrHelper.GetStringValue(dr[FIELD_CompanyID]);
            _companyname = StrHelper.GetStringValue(dr[FIELD_CompanyName]);
            _driverid = StrHelper.GetStringValue(dr[FIELD_DriverID]);
            _accidenttime = StrHelper.GetDateTimeValue(dr[FIELD_AccidentTime]);
            _accidentaddress = StrHelper.GetStringValue(dr[FIELD_AccidentAddress]);
            _accidentdesc = StrHelper.GetStringValue(dr[FIELD_AccidentDesc]);
            _accidentpic = StrHelper.GetStringValue(dr[FIELD_AccidentPic]);
            _accidentotherpic = StrHelper.GetStringValue(dr[FIELD_AccidentOtherPic]);
            _accidentresponsibility = StrHelper.GetStringValue(dr[FIELD_AccidentResponsibility]);
            _trafficpolicedisposition = StrHelper.GetStringValue(dr[FIELD_TrafficPoliceDisposition]);
            _trafficprocessrecord = StrHelper.GetStringValue(dr[FIELD_TrafficProcessRecord]);
            _totalcost = StrHelper.GetDecimalValue(dr[FIELD_TotalCost]);
            _insurancepay = StrHelper.GetDecimalValue(dr[FIELD_InsurancePay]);
            _adversepartypay = StrHelper.GetDecimalValue(dr[FIELD_AdversePartyPay]);
            _driverpay = StrHelper.GetDecimalValue(dr[FIELD_DriverPay]);
            _companypay = StrHelper.GetDecimalValue(dr[FIELD_CompanyPay]);
            _completedate = StrHelper.GetDateTimeValue(dr[FIELD_CompleteDate]);
            _recdivid = StrHelper.GetStringValue(dr[FIELD_RecDivID]);
            _recacct = StrHelper.GetStringValue(dr[FIELD_RecAcct]);
            _recdate = StrHelper.GetDateTimeValue(dr[FIELD_RecDate]);
            _note = StrHelper.GetStringValue(dr[FIELD_Note]);
            _useracct = StrHelper.GetStringValue(dr[FIELD_UserAcct]);
            _lastupdatedate = StrHelper.GetDateTimeValue(dr[FIELD_LastUpdateDate]);
            return this;
        }
        /// <summary>
        /// SetModel By DataTable
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <returns>BusAccident</returns>
        private BusAccident SetModel(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                SetModel(dr);
                break;
            }
            return this;
        }
        #endregion --Private--

    }
}

